﻿using System.Windows;
using System.Windows.Media;
using MahApps.Metro.Controls;

namespace MaxStoreErp.Core.Ui.MainMenu
{
    /// <summary>
    /// Пункт меню
    /// </summary>
    public class MenuItemControl : Tile, IMainMenuElement
    {
        public MenuItemControl()
        {
            SetCurrentValue(GroupNameProperty, "Unknown");
        }

        public static readonly DependencyProperty GroupNameProperty =
            DependencyProperty.Register("GroupName", typeof (string), typeof (MenuItemControl));

        public static readonly DependencyProperty IconDataProperty =
            DependencyProperty.Register("IconData", typeof (Geometry), typeof (MenuItemControl),
                new PropertyMetadata(default(Geometry)));

        public string GroupName
        {
            get
            {
                return (string) GetValue(GroupNameProperty);
            }
            set
            {
                SetValue(GroupNameProperty, value);
            }
        }

        public string TileCaption
        {
            get
            {
                return Title;
            }
            set
            {
                Title = value;
            }
        }

        public Geometry IconData
        {
            get { return (Geometry) GetValue(IconDataProperty); }
            set { SetValue(IconDataProperty, value); }
        }

        public bool IsTileVisible
        {
            get
            {
                return IsVisible;
            }
            set 
            {
                Visibility = value ? Visibility.Visible : Visibility.Collapsed;
            }
        }
    }
}
